package com.cosmocoder.monopoly.domain;

import java.util.HashSet;
import java.util.Set;

public class User {
	Set<Player> players;
	String login;
	
	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public Set<Player> getPlayers() {
		if(players == null) players = new HashSet<Player>();
		return players;
	}

	public void setPlayers(Set<Player> players) {
		this.players = players;
	}
	
	
	public boolean equals (User other) {
		return this.getLogin().equals(other.getLogin());
	}
	
	@Override
	public boolean equals(Object other) {
		if(other == null) return false;
		if(!(other instanceof User)) return false;
		return equals((User) other);
	}
	
	@Override
	public int hashCode() {
		return getLogin().hashCode();
	}
}
